<template>
  <el-dropdown
    trigger="click"
    @command="handleSizeChange">
    <svg-icon icon-class="size"></svg-icon>
    <template #dropdown>
      <el-dropdown-menu>
        <el-dropdown-item
          :command="item.value"
          v-for="item in sizeOption"
          :disabled="appStore.size == item.value"
          :key="item.value">
          {{ item.label }}
        </el-dropdown-item>
      </el-dropdown-menu>
    </template>
  </el-dropdown>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { useAppStore } from "@/store/modules/app";
const appStore = useAppStore();
const sizeOption = ref([
  { label: "默认", value: "default" },
  { label: "大型", value: "large" },
  { label: "小型", value: "small" },
]);
function handleSizeChange(size:string) {
  appStore.changeSize(size);
  ElMessage.success("切换布局大小成功");
}
</script>

<style scoped lang="scss"></style>
